package edu.whut.jdk7.calendar;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;

/*
        1.将Date对象转换Calendar时间对象
        Calendar c = Calendar.getInstance();
        c.setTime(date);

        2.根据Calendar得到Date对象
        Date date1 = c.getTime();
键盘录入日期字符串，输出这个日期是一年第多少天
 */
public class CalenderTest02 {
    public static void main(String[] args) throws ParseException {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        //将日期字符串转换为日期对象
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd");
        Date date = simpleDateFormat.parse(str);

        //将Date对象转换Calendar时间对象
        Calendar c = Calendar.getInstance();
        c.setTime(date);

        System.out.println("今年的第"+c.get(Calendar.DAY_OF_YEAR)+"天");

        Date date1 = c.getTime();
    }
    
}
